<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  </head>
  
  <body>
  	<!--<input type="button" class="btn btn-mini btn-info" value="增  加" id="add">
  	<input type="button" class="btn btn-mini btn-success" value="修  改" id="modify">
  	<input type="button" class="btn btn-mini btn-danger" value="删  除" id="delete">-->
    <div class="accordion-group widget-box">
      <div class="accordion-heading">
        <div class="widget-title"> 
        	<a data-parent="#collapse-group" href="#collapseGOne" data-toggle="collapse" class="collapsed">
         	<span class="icon"><i class="icon-search"></i></span>
          	<h5>检索条件</h5>
          	</a> 
        </div>
      </div>
      <div class="accordion-body in collapse" id="collapseGOne" style="height: auto;">
        <div class="form-horizontal">
        	<div class="control-group">
              <label class="control-label">问卷因子名称 :</label>
              <div class="controls">
              		<input type="text" placeholder="Factor Name" class="span10" id="factor_name">
              		<div class="button-search-right">
              			<input type="button" class="btn btn-success" value="检  索" id="searchButton">
              		</div>
              </div>
            </div>
        </div>
      </div>
    </div>
    
    <hr />
    <table id="tabGrid"></table>
    <div id="pager"></div>
    <script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery/jqGridUtil.js"></script>
   <script type="text/javascript">
	    jQuery(function(){	    	
	    	var factoryConfig = {
	           	url:'<%=request.getContextPath() %>/wjgl/yzgl/getFactorList.html',
	           	colModel:[
	           		{label:'id',name:"id",index:'FACTOR_ID', key:true ,hidden:true},
	           		{label:'因子名称',name:"name",index:'FACTOR_NAME'},
	           		{label:'备注',name:"comment",index:'COMMENT'},
	           		{label:'是否启用',name:"usedFlg",index:'USED_FLG',align:"center",formatter:'select',editoptions:{value:"0:启用;1:不启用"}}
	           	],
	           	table:"#tabGrid",
<%--	           	sortname:"FACTOR_NAME",--%>
	           	pager: "#pager",
	            caption:"试题信息列表"
	        };
	    	
	    	
	    	jQuery.loadGrid(factoryConfig);
	    	
	    	jQuery("#add").bind("click",function(){
	    		showDialog("增加问卷因子",626,332,"<%=request.getContextPath() %>/wjgl/yzgl/toAddFactor.html");
	    	});
	    	
	    	jQuery("#modify").bind("click",function(){
	    		var id = getChecked();
					if(id.length!=1){
						alert("请先选定一条记录!");
						return false;
					}
				
					var row = jQuery("#tabGrid").jqGrid('getRowData', id);
	    		showDialog("修改问卷因子",626,332,"<%=request.getContextPath() %>/wjgl/yzgl/toUpadteFactor.html?id="+row.id);
	    	});
	    	
	    	jQuery("#delete").bind("click",function(){
	    		plcz("<%=request.getContextPath() %>/wjgl/yzgl/deleteFactor.html","删除");
	    	});
	    	
	    	jQuery("#searchButton").bind("click",searchResult);
	    	
	    });
	    
	     function searchResult() {
	    	var map = {};
	    	map["name"] = jQuery('#factor_name').val();
			jQuery("#tabGrid").jqGrid('setGridParam',{  
	    	     postData : map
	    	 }).trigger('reloadGrid');
	    }
    </script>
  </body>
</html>
